package com.auction.controller.user;

import com.auction.pojo.AuctionCategory;
import com.auction.pojo.Result;
import com.auction.service.CategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController("userCategoryController")
@RequestMapping("/user/auction/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    /**
     * 查询所有启用的类目
     *
     * @return 分类列表
     */
    @GetMapping("/list")
    public Result<List<AuctionCategory>> list(Integer type) {
        log.info("查询所有启用的拍卖品分类");
        List<AuctionCategory> list = categoryService.list(type);
        return Result.success(list);
    }

}